package com.itheima.Demo01;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
// "jdbc:mysql://localhost:3306/db3"
public class JDBC  {
    public static void main (String[] args) throws Exception {
        //Class.forName("com.mysql.jdbc.Driver");
        Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/db3", "root", "root");
        Statement stat = con.createStatement();
        String sql = "Select * from product";
        ResultSet set = stat.executeQuery(sql);
        while (set.next()){
            System.out.println(set.getInt("id")+"\t"+set.getString("name")+"\t"+set.getInt("uid"));
        }
        con.close();
        stat.close();
        set.close();
    }
}
